#include <iostream>
#include <vector>
#include <string>
#include <boost/algorithm/string.hpp>

int main()
{
    std::vector<std::string> result_one;
    std::string target_one = "123x456x789";
    
    //第一个参数是把切分好的string,放入的vector
    //第二个参数是把什么string进行切分
    //第三个参数是以什么作为切割符
    //第四个参数是如果有多个切割符在一起,需不需要进行压缩
    //PS:默认第四个单数是token_conpress_off
    boost::split(result_one, target_one, boost::is_any_of("x"), boost::token_compress_off);

    std::vector<std::string> result_two;
    std::string target_two = "123x456xxxxxxx789";
    boost::split(result_two, target_two, boost::is_any_of("x"), boost::token_compress_off);

    std::vector<std::string> result_three;
    std::string target_three = "123x456xxxxxxx789";
    boost::split(result_three, target_three, boost::is_any_of("x"), boost::token_compress_on);

    for(auto &e : result_one)
    {
        std::cout << e << std::endl; 
    }

    for(auto &e : result_two)
    {
        std::cout << e << std::endl; 
    }

    for(auto &e : result_three)
    {
        std::cout << e << std::endl; 
    }

    return 0;
}
